<!DOCTYPE html>
<html>
    {include file="Widgets/head" /}
    <body class="gray-bg">
        <div class="wrapper wrapper-content animated fadeInUp">
            <div class="row">
                <div class="col-sm-12">
                    <div class="ibox">
                        <div class="ibox-title">
                            <h3>还款管理-已还款</h3>
                        </div>
                        <div class="ibox-content">
                            <div class="row m-b-sm m-t-sm">
                                <div class="row">
                                    <label class="col-sm-1 control-label text-right">已还款总额：</label>
                                    <div class="col-sm-2">
                                        {$total_pay}元
                                    </div>
                                </div>
                                <div class="hr-line-dashed"></div>
                                <form action="{:url('Repayment/haveRepayment')}" method="post" class="form-horizontal">
                                    <div class="form-group">
                                        <label class="col-sm-1 control-label" style="text-align:right;" for="borrower_name">借款人：</label>
                                        <div class="col-sm-2 m-b-xs">
                                            <input type="text" id="borrower_name" name="borrower_name" value="{$borrower_name}" class="form-control input-s-sm inline" placeholder="借款人">
                                        </div>
                                        <label class="col-sm-1 control-label" style="text-align:center;" for="title">关联标的：</label>
                                        <div class="col-sm-2 m-b-xs">
                                            <input type="text" id="title" name="title" value="{$title}" class="form-control input-s-sm inline" placeholder="关联标的">
                                        </div>
                                        <label class="col-sm-1 control-label" for="repayment_type" style="text-align:right;">还款方式：</label>
                                        <div class="col-sm-2 m-b-xs">
                                            <select id="repayment_type" name="repayment_type" class="form-control input-s-sm inline">
                                                {foreach $repayment_type_list as $key => $val} 
                                                <option value="{$key}" {if ($repayment_type == $key)} selected {/if}>{$val}</option>
                                                {/foreach}
                                            </select>
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="pull-left control-label col-sm-1" style="text-align:right;" for="real_repay_time_start">扣款时间：</label>
                                        <div class="col-sm-2">
                                            <input type="date" id="real_repay_time_start" name="real_repay_time_start"
                                                   value="{$real_repay_time_start}"
                                                   class="form-control laydate-icon input-s-sm inline layer-date"
                                                   onclick="laydate({istime: false, format: 'YYYY-MM-DD'})">
                                        </div>
                                        <label class="pull-left control-label col-sm-1" style="text-align:center;" for="real_repay_time_end">-</label>
                                        <div class="col-sm-2">
                                            <input type="date" id="real_repay_time_end" name="real_repay_time_end"
                                                   value="{$real_repay_time_end}"
                                                   class="form-control laydate-icon input-s-sm inline layer-date"
                                                   onclick="laydate({istime: false, format: 'YYYY-MM-DD'})">
                                        </div>
                                        <div class="col-sm-1">
                                            <button class="btn btn-primary" type="submit">查询</button>
                                        </div>
                                    </div>
                                </form>
                            </div>
                            <div class="hr-line-dashed"></div>
                            <table class="table table-bordered table-hover">
                                <thead>
                                    <tr>
                                        <th>ID</th>
                                        <th>借款人</th>
                                        <th>关联标的</th>
                                        <th>借款金额</th>
                                        <th>借款期限（天）</th>
                                        <th>总成本利率</th>
                                        <th>还款方式</th>
                                        <th>应还利息 </th>
                                        <th>总计应还金额</th>
                                        <th>扣款时间</th>
                                        <th>投资人</th>
                                        <th>投资时间</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    {if ($list)}
                                    {foreach $list as $key => $val} 
                                    <tr class="gradeA odd">
                                        <td>{$key + 1}</td>
                                        <td>{$val.borrower_name}</td>
                                        <td>{$val.title}</td>
                                        <td>{$val.amount}</td>
                                        <td>{$val.duration}</td>
                                        <td>{$val.interest_rate}%</td>
                                        <td>{$val.repayment_type}</td>
                                        <td>{$val.interest}</td>
                                        <td>{$val.total}</td>
                                        <td>{:date('Y-m-d H:i:s', $val.real_repay_time)}</td>
                                        <td>{$val.real_name}</td>
                                        <td>{$val.create_time}</td>
                                    </tr>
                                    {/foreach}                            
                                    {else /}
                                    <tr class="gradeA odd">
                                        <td style="text-align:center;" colspan="12">没有找到符合条件的记录</td>
                                    </tr>
                                    {/if}
                                </tbody>
                                <tfoot>
                                </tfoot>
                            </table>
                            {//分页}
                            <div>
                                <div class="row">
                                    {$paginator}
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </body>
</html>